#include <iostream> 
#include <vector> 
using namespace std;
const int MAXN = 8000001;
bool a[MAXN] = {
	0
};
vector<int>b;
void init(){
	for(int i = 2;i*i<=MAXN;++i)
		if(!a[i])
		for(int j = i*i;j<=MAXN;j+=i)
		a[j] = 1;
	for(int i = 2;i<MAXN;++i)
		if(!a[i])
		b.push_back(i);
	
}int main(){
	init();
	int n,s = 0,k = b.size()-1;
	cin>>n;
	int m = n/2;
	for(int i = 0;i<=b.size();++i){
		if(b[i]>m)
			break;
		for(int j = k;j>=0;j--){
			if(b[i]+b[j]==n)
				s++;
			if(b[i]+b[j]<n){
				k = j;
				break;
				
			}
		}
	}cout<<s;
	return 0;
	
}